import { takeEvery, takeLatest,all, fork } from 'redux-saga/effects'
import * as actionTypes from '@/app/Models/actions/actionTypes'
import { registerSaga, logoutSaga, loginSaga } from './auth'

export function* wathcAuth() {
    // 防止快速点击
    yield takeLatest(actionTypes.DO_REGISTER, registerSaga)
    yield takeEvery(actionTypes.DO_LOGOUT, logoutSaga)
    yield takeEvery(actionTypes.DO_LOGIN, loginSaga)
}

/**
 * 统一Effect注册
 */
export default function* rootSaga() {
    yield all([
        fork(wathcAuth)
        // 更多...
    ])
}